<?php
namespace app\portal\controller;
use cmf\controller\HomeBaseController;
use think\Db;
class MessageController extends HomeBaseController{
    public function addMessage(){
        $data = input();
        //验证码验证
        $check = cmf_captcha_check($data['captcha'],$data['_captcha_id']);
        if (!$check){
            $this->error('验证码错误');
        }
        $data['create_time'] = time();
        $res = db("message")->strict(false)->insert($data);
        if ($res){
            $this->success("恭喜你，留言成功！");
        }else{
            $this->error("抱歉，留言失败！");
        }
    }
    
    
   
}